
#include <iostream>
#include <stdlib.h>
#include <cuda_runtime.h>
#include <cutil.h>
#include "Prints.h"

using namespace std;

void printDeviceProps() {
    cudaDeviceProp prop;
    int dev;

    CUDA_SAFE_CALL(cudaGetDevice(&dev));
    cout << "dev = " << dev << endl;
    CUDA_SAFE_CALL(cudaGetDeviceProperties(&prop, dev));

    printf("Name:                    %s\n", prop.name);
    printf("Global Memory:           %d\n", prop.totalGlobalMem);
    printf("Shared Memory per Block: %d\n", prop.sharedMemPerBlock);
    printf("Register per Block:      %d\n", prop.regsPerBlock);
    printf("Warp Size:               %d\n", prop.warpSize);
    printf("Memory Pitch:            %d\n", prop.memPitch);
    printf("Max Threads Per Block:   %d\n", prop.maxThreadsPerBlock);
    printf("Max Threads Dimension:   %d %d %d\n", prop.maxThreadsDim[0], prop.maxThreadsDim[1], prop.maxThreadsDim[2]);
    printf("Max Grid Size:           %d %d %d\n", prop.maxGridSize[0], prop.maxGridSize[1], prop.maxGridSize[2]);
    printf("Constant Memory:         %d\n", prop.totalConstMem);
    printf("Version:                 %d.%d\n", prop.major, prop.minor);
    printf("Clock Rate:              %d\n", prop.clockRate);
    printf("Texture Alignment:       %d\n", prop.textureAlignment);
}

void printDadosIniciais() {
    cout << "\n-------------------- DADOS DA SIMULACAO --------------------" << endl;
    cout << "Numero de particulas: " << totalParticulas << endl;
    cout << "Numero de linhas do Grid (resolucao Y do grid): " << resolucaoGridY << endl;
    cout << "Numero de colunas do Grid (resolucao X do grid): " << resolucaoGridX << endl;
    cout << "Numero de colunas para distribuicao das particulas (resolucao X das particulas): " << resolucaoPartX << endl;
    cout << "Numero de linhas para distribuicao das particulas (resolucao Y das particulas): " << resolucaoPartY << endl;
    cout << "DeltaX do grid: " << deltaXGrid << endl;
    cout << "DeltaY do grid: " << deltaYGrid << endl;
    cout << "------------------------------------------------------------" << endl;
    getchar();
}

void printPosicoesParticulas() {
    for (int j = 0; j < totalParticulas; j++) {
        cout << "A posição (X) " << j << " do vetor 1 e igual a " << posicoesParticulas[j].x << endl;
    }
    getchar();

    for (int j = 0; j < totalParticulas; j++) {
        cout << "A posição (Y) " << j << " do vetor 1 e igual a " << posicoesParticulas[j].y << endl;
    }
    getchar();
}

void printPosicoesParticulas2() {
    for (int j = 0; j < totalParticulas; j++) {
        cout << "A posição (X) " << j << " do vetor 2 e igual a " << posicoesParticulas2[j].x << endl;
    }
    getchar();

    for (int j = 0; j < totalParticulas; j++) {
        cout << "A posição (Y) " << j << " do vetor 2 e igual a " << posicoesParticulas2[j].y << endl;
    }
    getchar();
}

void printDadosParticulas() {
    for (int i = 0; i < totalParticulas; i++) {
        cout << "id: " << values[i] << "\t idCell: " << keys[i] <<
                "\t Massa Esp: " << particulas[values[i]].massaEspecifica <<
                "\t Pressao: " << particulas[values[i]].pressao <<
                "\t Velo(x): " << particulas[values[i]].velocidade.x << endl;
    }
    getchar();
}

void printDadosParticulas2() {
    for (int i = 0; i < totalParticulas; i++) {
        cout << "id: " << values[i] << "\t idCell: " << keys[i] <<
                "\t Massa Esp: " << particulas2[values[i]].massaEspecifica <<
                "\t Pressao: " << particulas2[values[i]].pressao <<
                "\t Velo(x): " << particulas2[values[i]].velocidade.x << endl;
    }
    getchar();
}

void printCells() {
    for (int i = 0; i < totalParticulas; i++) {
        cout << "id: " << values[i] << "\t idCell: " << keys[i] << endl;
    }
    getchar();
}

void printCount() {
    for (int i = 0; i < totalParticulas; i++) {
        cout << "count[" << i << "] : " << count[i] << endl;
    }
    getchar();
}